package com.exam.example.action;



import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.exam.example.model.News;
import com.exam.example.service.NewsService;
import com.opensymphony.xwork2.ActionSupport;

public class ExcStudentAtion extends ActionSupport {
	Log logger = LogFactory.getLog(ExcStudentAtion.class);
	
	private NewsService newsService;
	private News news;
	
	public void setNews(News news) {
		this.news = news;
	}

	public String addStudent(){
		System.out.println("ExcStudentAtion ====addNews");
		System.out.println("ExcStudentAtion ====content"+this.news.getContent11());
		if(null!= this.news){
			
			newsService.addNews(this.news);
		}
		
	/*	HttpServletRequest request=  ServletActionContext.getRequest();
		Object obj=request.getParameter("user");*/
//		Map<String,Class<?>> m  = new HashMap<String,Class<?>>();
//		m.put("name", String.class);
//		m.put("userId", String.class);
//		m.put("element",Element.class);

		/*Student s=(Student)JSONObject.toBean( JSONObject.fromObject(obj),Student.class);
		System.out.println(s.getName());
		System.out.println(s.getAddress());
		System.out.println(s.getAge());*/
//		List<Student> list = new ArrayList<Student>();
//		for(int i = 0;i<20;i++){
//			Student stu = new Student();
//			stu.setName("name"+i);
//			stu.setAge(i);
//			stu.setAddress("pujian road"+i+"#");
//			list.add(stu);
//		}
		
	//	ServletActionContext.getRequest().setAttribute("jsobj",   JSONArray.fromObject(list));
		
	//ServletActionContext.getRequest().setAttribute("jsobj",  JSONObject.fromObject(s));
		return SUCCESS;
	}

	public void setNewsService(NewsService newsService)
	{
		this.newsService = newsService;
	}
	

	
}
